<style type="text/css">
    .layui-table-body{overflow-x:auto;}
    .layui-table-cell{font-size:12px;}
</style>
<table id="dataTable"></table>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    {{# if(d.status == 1){  }}
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '1300px', height: '600px', title: '修改'}">修改</a>
     {{# } }}

    <a href="{:url('look')}?id={{ d.id }}&type=1" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '1300px', height: '600px', title: '查看详情'}">详情</a>
    {{# if(d.status == 1 && {$shop_id} == d.b_shop){  }}

    <a href="{:url('look')}?id={{ d.id }}&type=0" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '1200px', height: '600px', title: '查看详情'}">审核</a>
    {{# } }}
    <a href="{:url('edit')}?id={{ d.id }}&xx=2" class="layui-btn layui-btn-xs layui-btn-normal " target='_blank'>打印</a>
    <!-- <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a> -->
</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    <a href="{:url('add')}" class="layui-btn layui-btn-normal layui-btn-sm hisi-iframe-pop" hisi-data="{width: '1300px', height: '600px', title: '添加'}">&nbsp;添加</a>
</script>
<script type="text/javascript">
    layui.use(['table'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[ //表头
                {type:'checkbox'}
                ,{field: 'id',width:70, title: 'ID'}
                ,{field: 'sn', title: '订单编号'}
                ,{field: 'a_shop_name', title: '调出门店'}
                ,{field: 'a_warehouse_name', title: '调出仓库'}
                ,{field: 'b_shop_name', title: '调入门店'}
                ,{field: 'b_warehouse_name', title: '调入仓库'}
                ,{field: 'status', title: '状态', templet:function(d){
                    switch(d.status){
                        case 1:
                            var str = '待审核';
                            break;
                        case 2:
                            var str = '通过';
                            break;
                        case 3:
                            var str = '不通过';
                            break;
                    }
                    return str;
                }}
                ,{field: 'bak', title: '备注'}
                ,{field: 'createtime', title: '创建时间'}
                ,{title: '操作', width: 180, templet: '#buttonTpl'}
            ]]

        });
    });
</script>
